package com.tieland.xunda.common.base;

import com.tieland.xunda.common.sys.UserContext;
import com.tieland.xunda.common.sys.DefaultUserContext;
import net.buffalo.request.RequestContext;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * User: qiukx
 * Date: 2008-7-16
 * Company: tieland
 * Description:
 */
public class AjaxService {
    private RequestContext requestContext;
    private HttpServletRequest req;
    private HttpServletResponse res;
    private HttpSession session;
    private Map cookie;

    private UserContext userContext;

    public AjaxService(){
        this.requestContext = RequestContext.getContext();
        this.req = requestContext.getHttpRequest();
        this.res = requestContext.getHttpResponse();
        this.cookie = requestContext.getCookie();
        this.session = this.req.getSession();
        this.userContext = new DefaultUserContext(req,res);

    }

    public HttpServletRequest getReq() {
        return req;
    }

    public HttpServletResponse getRes() {
        return res;
    }

    public HttpSession getSession() {
        return session;
    }

    public UserContext getUserContext() {
        return userContext;
    }

    public Map getCookie() {
        return cookie;
    }

    public RequestContext getRequestContext() {
        return requestContext;
    }
}
